// 搜索框组件
import { Input } from '@douyinfe/semi-ui';
import searchStyle from './index.less';

const Search = () => {
  const data = {
    searchValue: '',
  };
  const goSearch = (e: any) => {
    if (e.keyCode == 13) {
      window.open('https://www.baidu.com/s?wd=' + data.searchValue, '_blank');
    }
  };
  const changeSearchInput = (value: any) => {
    data.searchValue = value;
  };
  return (
    <div className={searchStyle.search_container}>
      <Input
        onKeyDown={goSearch}
        onChange={changeSearchInput}
        className={searchStyle.input_style}
        placeholder="百度一下"
        size="large"
      ></Input>
    </div>
  );
};

export default Search;
